<template>
  <div>
    <FilterTable
      ref="table"
      columnsRef="allocationInshowExRef"
      :columns="columns"
      :datakey="'rows'"
      :dataSource="dataSource"
      :onSyncTableData="handleSyncTableData"
      :onColumnsChange="columns => (this.columns = columns)"
    >
    </FilterTable>
    <div class="btnWrap">
      <el-button @click="closeDrawer(1)">关 闭</el-button>
    </div>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
import { confirmAction, notifyAction } from '@/utils';

export default {
  mixins: [dictionary],
  data() {
    return {
      columns: this.createTableColumns(),
      dataSource: [],
      showPanel: false
    };
  },
  mounted() {
    this.columns.find(x => x.dataIndex == 'orderStatus').dictItems = this.createDictList('9031');
    this.columns.find(x => x.dataIndex == 'orderStatus').filterItems = this.createDictList('9031');
    this.dataSource = this.data;
  },
  props: {
    data: Array
  },
  methods: {
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '审核日期',
          dataIndex: 'createdAt',
          sorter: true,
          filter: true,
          filterType: 'date-range',
          dateFormat: 'yyyy-MM-dd',
          showOverflowTooltip: true
        },
        {
          title: '审核人',
          dataIndex: 'createdBy',
          sorter: true,
          filter: true,
          filterType: 'input',
          showOverflowTooltip: true
        },
        {
          title: '审核状态',
          dataIndex: 'orderStatus',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [],
          dictItems: [],
          showOverflowTooltip: true
        },
        {
          title: '审核意见',
          dataIndex: 'examinedRemark',
          sorter: true,
          filter: true,
          filterType: 'input',
          showOverflowTooltip: true
        }
      ];
    },
    async closeDrawer(val) {
      if (val == 1) {
        this.$emit('close', false);
      }
    },
    collapseHandle() {
      this.nextTick(() => {
        this.refs.table.EXECUTE_RESET_HEIGHT();
      });
    },
    // 点击搜索
    handleSearch() {},
    // 同步table数据
    handleSyncTableData(list) {
      this.syncTableData = list;
    }
  }
};
</script>

<style lang="less" scoped>
.btnWrap {
  position: absolute;
  left: 0px;
  bottom: 0px;
  right: 0px;
  z-index: 9;
  border-top: 1px solid rgb(233, 233, 233);
  padding: 10px 20px;
  background: rgb(255, 255, 255);
  text-align: right;
}
</style>
